package com.futures.questionbank.ui.home;

import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.futures.questionbank.Constants.Constants;
import com.futures.questionbank.R;
import com.futures.questionbank.adapter.HomeJobAdapter;
import com.futures.questionbank.base.BaseActivity;
import com.futures.questionbank.bean.HangQinBean;
import com.futures.questionbank.http.CallBack;
import com.futures.questionbank.http.HttpClient;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;

public class OneHotActivity extends BaseActivity {
    @BindView(R.id.rl_choice)
    RecyclerView rlJob2;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.hang_fragment);
        setTitle("最热");

    }

    @Override
    protected void loadData() {
        rlJob2.setLayoutManager(new LinearLayoutManager(this));
        rlJob2.setItemAnimator(new DefaultItemAnimator());
        HomeJobAdapter homeJobAdapter = new HomeJobAdapter(this);
        rlJob2.setAdapter(homeJobAdapter);

        Map<String, Object> params = new HashMap<>();
        params.put("v","1.0");
        params.put("appKey","Android_1.0");
        params.put("sessionid","adb6ae4d3923483180d500b61bbfb0cb");
        params.put("sign","4FB561C49AE9D3B78F24BBC33E76F772FBE7692D");
        params.put("method","community.post.hot");
        params.put("fm","json");


        HttpClient.post(this, Constants.WAS, params, new CallBack<List<HangQinBean>>() {
            @Override
            public void onSuccess(List<HangQinBean> jobListBeans) {
                homeJobAdapter.replaceAll(jobListBeans, true);
            }
        });

    }
}
